<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<title>javascript正则表达式</title>
	</head>
	<body>
		<h1>javascript正则表达式的使用</h1>
		<script type="text/javascript">
			var reg=new RegExp("^1[3589]\\d{9}$");
			var reg2=/1[3589]\d{9}$/;
			
			var b=reg2.test("13167371397");
			document.write(b+"<br/>");
			
			
			var reg3=/^abc$/i;
			
			var b2=reg3.test("ABC");
			document.write(b2+"<br/>");
			
			var content="java真好，java真棒，Java第一,JAVA";
			
			var reg4=/java/ig;
			
			var v=null;
			while(v=reg4.exec(content)){
				document.write(v+"<br/>");
			}
			

			var str="hello java,java是最好的语言，我爱Java";
			var reg5=/java/ig;
			var arr=str.match(reg5);
			document.write(arr.length);
			
		</script>
	</body>
</html>
